ARM: GICv3: handle unmapped LPIs
authorAndre Przywara <andre.przywara@arm.com>
Wed, 12 Apr 2017 00:14:42 +0000 (01:14 +0100)
committerStefano Stabellini <sstabellini@kernel.org>
Wed, 14 Jun 2017 18:38:38 +0000 (11:38 -0700)
commitbccfbe70a36fc0acd8ca2e3db9380a01938eae8a
tree547adcf870882f057dde8c98cc7dbd161291c6f8
parent08055c8ea71b4959908caf3b511cddd648085768
ARM: GICv3: handle unmapped LPIs

When LPIs get unmapped by a guest, they might still be in some LR of
some VCPU. Nevertheless we remove the corresponding pending_irq
(possibly freeing it), and detect this case (irq_to_pending() returns
NULL) when the LR gets cleaned up later.
However a *new* LPI may get mapped with the same number while the old
LPI is *still* in some LR. To avoid getting the wrong state, we mark
every newly mapped LPI as PRISTINE, which means: has never been in an
LR before. If we detect the LPI in an LR anyway, it must have been an
older one, which we can simply retire.
Before inserting such a PRISTINE LPI into an LR, we must make sure that
it's not already in another LR, as the architecture forbids two
interrupts with the same virtual IRQ number on one CPU.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Julien Grall <julien.grall@arm.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
xen/arch/arm/gic.c
xen/include/asm-arm/vgic.h